package com.brunogb.pages.server.action;

import javax.servlet.http.HttpServletRequest;

import org.vraptor.annotations.Component;
import org.vraptor.annotations.In;
import org.vraptor.annotations.InterceptedBy;
import org.vraptor.annotations.Out;

import com.brunogb.pages.security.Protected;
import com.brunogb.pages.server.interceptors.UserInterceptor;
import com.brunogb.pages.server.services.PageServiceImpl;
import com.google.appengine.api.users.User;


/**
 * @author bruno bilescky
 * 
 */
@Component
@InterceptedBy(UserInterceptor.class)
@SuppressWarnings("all")
public class HomeAction {
	
	@Out private String query = "";

	@In
	private HttpServletRequest request;
	
	@Out
	private User user;
	
	private PageServiceImpl pageService;
	
	@Out
	private int totalPages;
	
	/**
	 * 
	 */
	public void home() {
		pageService = new PageServiceImpl();
		totalPages = pageService.getTotalCountPages();
	}
	
	@Protected
	public void library() {
		this.user = (User)request.getAttribute("user");
	}
	
	public void notFound(){
		
	}

}
